//
//  YYMusicView.m
//  ONE
//
//  Created by dllo on 16/6/7.
//  Copyright © 2016年 GroupNine. All rights reserved.
//

#import "YYMusicView.h"

@implementation YYMusicView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        /** 头像 */
        self.imageView = [UIImageView new];
        self.imageView.backgroundColor = [UIColor redColor];
        self.imageView.layer.cornerRadius = 25;
        [self addSubview:_imageView];
        
        /** 姓名 */
        self.nameLabel = [UILabel new];
        self.nameLabel.text = @"陈绮贞";
        self.nameLabel.backgroundColor = [UIColor greenColor];
        self.nameLabel.textColor = [UIColor colorWithRed:0.90 green:0.98 blue:1.00 alpha:1.00];
        self.nameLabel.textAlignment = 0;
        self.nameLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:_nameLabel];

        /** 介绍 */
        self.introLabel = [UILabel new];
        self.introLabel.text = @"陈绮贞, 独立歌手, 创作型才女.";
        self.introLabel.backgroundColor = [UIColor greenColor];
        self.introLabel.font = [UIFont systemFontOfSize:13];
        self.introLabel.textAlignment = 0;
        self.introLabel.textColor = [UIColor grayColor];
        self.introLabel.numberOfLines = 0;
        [self addSubview:_introLabel];
        
        /** 歌名 */
        self.musicNameLabel = [UILabel new];
        self.musicNameLabel.backgroundColor = [UIColor whiteColor];
        self.musicNameLabel.text = @"告诉我";
        self.musicNameLabel.textAlignment = 0;
        self.musicNameLabel.font = [UIFont systemFontOfSize:17];
        [self addSubview:_musicNameLabel];
        
        /** 播放按钮 */
        self.playButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.playButton.backgroundColor = [UIColor blueColor];
        [self.playButton addTarget:self action:@selector(didclickenPlayButton:) forControlEvents:UIControlEventTouchDown];
        [self addSubview:_playButton];
        
        /** 日期 */
        self.dataLabel = [UILabel new];
        self.dataLabel.textAlignment = 2;
        self.dataLabel.backgroundColor = [UIColor greenColor];
        self.dataLabel.text = @"Jun. 07, 2016";
        self.dataLabel.textColor = [UIColor grayColor];
        self.dataLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:_dataLabel];
    }
    return self;
}

- (void)layoutSubviews
{
    /* 头像 */
    self.imageView.frame = CGRectMake(20, 25, 50, 50);
    
    /** 姓名 */
    self.nameLabel.frame = CGRectMake(self.imageView.frame.origin.x + self.imageView.frame.size.width + 10, self.imageView.frame.origin.y + 5, SCREEN_WIDTH / 2, 20);
    
    /** 介绍 */
    self.introLabel.frame = CGRectMake(self.nameLabel.frame.origin.x, self.nameLabel.frame.origin.y + self.nameLabel.frame.size.height + 5, self.nameLabel.frame.size.width, self.nameLabel.frame.size.height * 2);
    
    /** 歌名 */
    self.musicNameLabel.frame = CGRectMake(self.imageView.frame.origin.x, self.introLabel.frame.origin.y + self.introLabel.frame.size.height, SCREEN_WIDTH / 2, 30);
    
    /** 播放按钮 */
    self.playButton.frame = CGRectMake(self.introLabel.frame.origin.x + self.introLabel.frame.size.width + 5, self.introLabel.frame.origin.y, self.imageView.frame.size.height, self.imageView.frame.size.width);
    
    /** 日期 */
    self.dataLabel.frame = CGRectMake(self.musicNameLabel.frame.origin.x + self.musicNameLabel.frame.size.width, self.playButton.frame.origin.y + self.playButton.frame.size.height + 10, SCREEN_WIDTH / 3, self.nameLabel.frame.size.height);
    
    
}

#pragma mark -- 播放按钮点击方法
- (void)didclickenPlayButton:(UIButton *)button
{
    
}


@end
